<template>
  <view class="container">
    <!-- Logo区域 -->
    <view class="header">
      <image class="logo" src="/static/logo.png" mode="aspectFit"></image>
      <text class="title">南风应用中心</text>
    </view>

    <!-- 功能入口（居中布局） -->
    <view class="function-grid">
      <view 
        class="function-card"
        v-for="item in functions"
        :key="item.type"
        @click="navigateTo(item.type)"
        :style="{ background: item.color }"
      >
        <view class="card-content">
          <text class="card-icon">{{ item.icon }}</text>
          <text class="card-title">{{ item.title }}</text>
        </view>
        <view class="card-wave"></view>
      </view>
    </view>
  </view>
</template>

<script setup>
const functions = [
  { 
    type: '2048',
    title: '2048游戏',
    icon: '🎮',
    color: 'linear-gradient(135deg, #FF6B6B, #FF8E53)'
  },
  { 
    type: 'goldprice',
    title: '金价查询',
    icon: '💰',
    color: 'linear-gradient(135deg, #4ECDC4, #45B7D1)'
  }
]

const navigateTo = (type) => {
  const routes = {
    '2048': '/pages/2048/2048',
    'goldprice': '/pages/goldprice/goldprice'
  }
  uni.navigateTo({ url: routes[type] })
}
</script>

<style lang="scss">
.container {
  height: 100vh;
  background: #f5f7fa;
  padding: 40rpx;
}

.header {
  text-align: center;
  margin-top: 80rpx;
  
  .logo {
    width: 240rpx;
    height: 240rpx;
    border-radius: 24rpx;
    box-shadow: 0 8rpx 24rpx rgba(0,0,0,0.1);
  }
  
  .title {
    display: block;
    font-size: 44rpx;
    color: #2c3e50;
    margin-top: 40rpx;
    font-weight: 600;
    letter-spacing: 2rpx;
  }
}

.function-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40rpx;
  margin-top: 120rpx;
  max-width: 600rpx;
  margin-left: auto;
  margin-right: auto;
}

.function-card {
  height: 280rpx;
  border-radius: 32rpx;
  overflow: hidden;
  position: relative;
  transition: all 0.3s ease;
  transform: translateY(0);
  
  &:active {
    transform: translateY(6rpx);
    opacity: 0.9;
  }
  
  .card-content {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
  }
  
  .card-icon {
    font-size: 80rpx;
    margin-bottom: 20rpx;
    animation: float 3s ease-in-out infinite;
  }
  
  .card-title {
    font-size: 36rpx;
    color: #fff;
    font-weight: 500;
    text-shadow: 0 2rpx 4rpx rgba(0,0,0,0.2);
  }
  
  .card-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60rpx;
    background: rgba(255,255,255,0.2);
    animation: wave 3s linear infinite;
  }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20rpx); }
}

@keyframes wave {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
</style>